<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="Bai2_9.php">
  <table width="500" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td colspan="2">TÌM KIẾM THÔNG TIN SỮA</td>
    </tr>
    <tr>
      <td>Tên sữa:
        <input type="text" name="txtTenSua" id="textfield" /></td>
      <td><input type="submit" name="button" id="button" value="Tìm kiếm" /></td>
    </tr>
  </table>
</form>
  <?php
  	//ket noi server
	$db=mysql_connect("localhost","root","");
	if(!$db)
	{
		echo "Can not connect to server";
		exit;
	}
	mysql_select_db("ql_ban_sua");
	if(isset($_POST['txtTenSua'])&&$_POST['txtTenSua']!="")
	{
		$ten_sua=$_POST['txtTenSua'];
		$result=mysql_query("select * from sua, hang_sua where sua.ma_hang_sua=hang_sua.ma_hang_sua and ten_sua like '%$ten_sua%'");
		if(mysql_num_rows($result)<>0)
		{
			$count=mysql_num_rows($result);
			echo "<p align='center'>co $count san pham</p>";
			while($row=mysql_fetch_row($result))
			{
				$ten=$row->Ten_sua;
				$dongia=$row->Don_gia;
				echo $ten." - ".$dongia."<br />";
			}
		}
	
	}
  ?>
</body>
</html>